package br.com.naybee.framework.client.componente.gwt.web;

import com.google.gwt.dom.client.InputElement;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.ui.ComplexPanel;

public class InputText extends ComplexPanel implements HasClickHandlers {

	private InputElement inputElementnt = DOM.createInputText().cast();

	public InputText() {
		setElement(inputElementnt);
	}

	public void setName(String name) {
		inputElementnt.setName(name);
	}

	public String getName() {
		return inputElementnt.getName();
	}

	public void setDisabled(boolean disabled) {
		inputElementnt.setDisabled(disabled);
	}

	public void setClassId(String id) {
		inputElementnt.setId(id);
	}

	public String getClassId() {
		return inputElementnt.getId();
	}

	public void setText(String text) {
		inputElementnt.setInnerText(text);
	}

	public String getText() {
		return inputElementnt.getInnerText();
	}

	public void setValue(String value) {
		inputElementnt.setValue(value);
	}

	public String getValue() {
		return inputElementnt.getValue();
	}

	public void setPlaceholder(String placeholder) {
		inputElementnt.setAttribute("placeholder", placeholder);
	}

	public String getPlaceholder() {
		return inputElementnt.getAttribute("placeholder");
	}

	public void setType(String type) {
		inputElementnt.setAttribute("type", type);
	}

	public String getType() {
		return inputElementnt.getAttribute("type");
	}

	public void setClassName(String className) {
		inputElementnt.setClassName(className);
	}

	public String getClassName() {
		return inputElementnt.getClassName();
	}

	public HandlerRegistration addClickHandler(ClickHandler handler) {
		return addDomHandler(handler, ClickEvent.getType());
	}

}
